import sys,time
import os
import pandas as pd
from Predict_6624Job import Predict_6624Job

def main(mode,bf_no,avg_iron_temp,avg_c_s_value,compute_slag_rate,compute_fill_s_value,
        zongjiaobi,create_date,old_vm,old_s,old_unit_price,new_vm,new_s,new_unit_price,
        old_jiaotan_s,new_jiaotan_s):
    result_list = []
    try:
        mode = int(mode)
        avg_iron_temp = float(avg_iron_temp)
        avg_c_s_value = float(avg_c_s_value)
        compute_slag_rate = float(compute_slag_rate)
        compute_fill_s_value = float(compute_fill_s_value)
        zongjiaobi = float(zongjiaobi)

        success_tmp = True
        msg = ''
        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    except Exception as e:
        success_tmp = False
        msg = f'invalid_parameter_type--{str(e)}'
        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    if success_tmp:
        msg, result_list = Predict_6624Job(p_mode=mode,p_bf_no=bf_no, p_avg_iron_temp=avg_iron_temp,
                                           p_avg_c_s_value=avg_c_s_value, p_compute_slag_rate=compute_slag_rate,
                                           p_compute_fill_s_value=compute_fill_s_value, p_zongjiaobi=zongjiaobi,
                                           p_create_date=create_date,
                                           p_old_vm=old_vm, p_old_s=old_s, p_old_unit_price=old_unit_price,
                                           p_new_vm=new_vm, p_new_s=new_s, p_new_unit_price=new_unit_price,
                                           p_old_jiaotan_s=old_jiaotan_s, p_new_jiaotan_s=new_jiaotan_s).execute()
        timestamp = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
        success_tmp = True
    success = success_tmp
    message = msg
    timestamp = timestamp
    table_1 = result_list
    return success, message, timestamp, table_1
if __name__ == '__main__':
    mode = 1
    bf_no = 1
    avg_iron_temp = 1511
    avg_c_s_value = 122
    compute_slag_rate = 303
    compute_fill_s_value = 349

    zongjiaobi = 324.565

    create_date = '20240101'

    old_vm = ''
    old_s = ''
    old_unit_price = ''
    new_vm = ''
    new_s = ''
    new_unit_price = ''

    old_jiaotan_s = ''
    new_jiaotan_s = ''
    success, message, timestamp, table_1 = main(mode,bf_no,avg_iron_temp,avg_c_s_value,compute_slag_rate,compute_fill_s_value,
                                                zongjiaobi,create_date,old_vm,old_s,old_unit_price,new_vm,new_s,new_unit_price,
                                                old_jiaotan_s,new_jiaotan_s)
    print(success, message, timestamp, table_1)
